//
//  ViewController.m
//  CustomPicker
//
//  Created by Joinwe on 16/3/24.
//  Copyright © 2016年 Joinwe. All rights reserved.
//

#import "ViewController.h"
#import "CustomPicker.h"
#import "ViewController2.h"

@interface ViewController ()<CustomPickerDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(10, 80, 300, 50);
    button.backgroundColor = [UIColor greenColor];
    [button addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    button2.frame = CGRectMake(10, 200, 300, 50);
    button2.backgroundColor = [UIColor greenColor];
    [button2 addTarget:self action:@selector(btnClick1) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];
    
}

- (void)btnClick1{
    [UIApplication sharedApplication].keyWindow.rootViewController = [[ViewController2 alloc] init];
}

- (void)btnClick{
    NSArray *imageArray = @[@"beijing",@"gs",@"gd",@"gf",@"js",@"jt",@"ms",@"ny",@"pa",@"ns",@"pf",@"xy",@"zg",@"zs",@"zx",@"yz"];
    NSArray *bankArray = @[@"北京银行",@"中国工商银行",@"中国光大银行",@"广发银行",@"中国建设银行",@"交通银行",@"中国民生银行",@"中国农业银行",@"平安银行",@"上海农商银行",@"浦发银行",@"兴业银行",@"中国银行",@"招商银行",@"中信银行",@"邮政储蓄银行"];
    
    CustomPicker *customPicker = [CustomPicker sharePickWithImageArray:imageArray nameArray:bankArray];
    NSLog(@"========%@",customPicker);
    customPicker.delegate = self;
    [self.view addSubview:customPicker];
    [customPicker show];
}

- (void)bankImage:(NSString *)imageName bankName:(NSString *)name{
    NSLog(@"-------%@------%@",imageName,name);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
